package com.anpy.bill.service.impl;

import com.anpy.bill.mapper.AppMapper;
import com.anpy.bill.model.result.AppResult;
import com.anpy.bill.service.AppService;
import com.anpy.common.service.BaseServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Author : anpy
 * @create 2024/1/22 17:08
 */
@Service
public class AppServiceImpl extends BaseServiceImpl<AppMapper, AppResult> implements AppService {

    @Resource
    private AppMapper appMapper;

    @Override
    public AppResult homeData(Long userId) {
        AppResult appResult = appMapper.appData(userId);
        int noteFolderCount = appMapper.queryNoteFolder(userId);
        int notesCount = appMapper.queryNotes(userId);
        int courseFolder = appMapper.queryCourseFolder(userId);
        appResult.setCourseCount(courseFolder+"");
        appResult.setNotesCount(notesCount+"");
        appResult.setNoteFolderCount(noteFolderCount+"");
        return appResult;
    }
}
